{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>distance</th>\n",
       "      <th>direction</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.014872</td>\n",
       "      <td>-0.073061</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.811171</td>\n",
       "      <td>0.040348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.784988</td>\n",
       "      <td>0.017991</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.119175</td>\n",
       "      <td>0.005638</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.262065</td>\n",
       "      <td>0.022443</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.919015</td>\n",
       "      <td>-0.036594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.873110</td>\n",
       "      <td>0.027826</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1.070208</td>\n",
       "      <td>-0.010506</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1.136828</td>\n",
       "      <td>0.008138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0.945939</td>\n",
       "      <td>-0.105008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.987615</td>\n",
       "      <td>-0.006331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.205463</td>\n",
       "      <td>0.052046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>0.958843</td>\n",
       "      <td>0.014954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1.002921</td>\n",
       "      <td>0.017638</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0.808036</td>\n",
       "      <td>0.006072</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0.885812</td>\n",
       "      <td>0.009431</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>0.885897</td>\n",
       "      <td>-0.051119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>0.896757</td>\n",
       "      <td>0.039138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0.987803</td>\n",
       "      <td>0.091702</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0.986813</td>\n",
       "      <td>0.018123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>0.823929</td>\n",
       "      <td>0.017358</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1.359914</td>\n",
       "      <td>-0.019783</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1.052995</td>\n",
       "      <td>0.014265</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>0.941338</td>\n",
       "      <td>-0.053790</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>1.040544</td>\n",
       "      <td>0.010090</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>0.992751</td>\n",
       "      <td>-0.012571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>1.228835</td>\n",
       "      <td>0.063801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1.317062</td>\n",
       "      <td>-0.027550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>1.105235</td>\n",
       "      <td>-0.006007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1.066970</td>\n",
       "      <td>-0.030088</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>874</th>\n",
       "      <td>0.988875</td>\n",
       "      <td>-0.060102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>875</th>\n",
       "      <td>1.026914</td>\n",
       "      <td>0.037079</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>876</th>\n",
       "      <td>1.237129</td>\n",
       "      <td>-0.033020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>877</th>\n",
       "      <td>0.942776</td>\n",
       "      <td>-0.087547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>878</th>\n",
       "      <td>1.079147</td>\n",
       "      <td>0.036347</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>879</th>\n",
       "      <td>0.935685</td>\n",
       "      <td>-0.051473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>880</th>\n",
       "      <td>0.835867</td>\n",
       "      <td>0.024130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>881</th>\n",
       "      <td>0.984819</td>\n",
       "      <td>0.011195</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>882</th>\n",
       "      <td>1.059956</td>\n",
       "      <td>0.050766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>883</th>\n",
       "      <td>1.037110</td>\n",
       "      <td>-0.056266</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>884</th>\n",
       "      <td>1.041138</td>\n",
       "      <td>-0.022192</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>885</th>\n",
       "      <td>0.974711</td>\n",
       "      <td>-0.042435</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>886</th>\n",
       "      <td>1.005050</td>\n",
       "      <td>-0.005776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>887</th>\n",
       "      <td>0.931255</td>\n",
       "      <td>-0.015503</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>888</th>\n",
       "      <td>1.257316</td>\n",
       "      <td>-0.055352</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>889</th>\n",
       "      <td>0.989798</td>\n",
       "      <td>-0.004721</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>890</th>\n",
       "      <td>0.860510</td>\n",
       "      <td>0.013746</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>891</th>\n",
       "      <td>1.094758</td>\n",
       "      <td>-0.036899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>892</th>\n",
       "      <td>0.763186</td>\n",
       "      <td>0.029647</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>893</th>\n",
       "      <td>0.891375</td>\n",
       "      <td>0.077918</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>894</th>\n",
       "      <td>0.793538</td>\n",
       "      <td>-0.012601</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>895</th>\n",
       "      <td>0.871301</td>\n",
       "      <td>0.041858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>896</th>\n",
       "      <td>1.037124</td>\n",
       "      <td>0.039784</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>897</th>\n",
       "      <td>0.630603</td>\n",
       "      <td>0.019173</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>898</th>\n",
       "      <td>0.925366</td>\n",
       "      <td>0.014392</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>899</th>\n",
       "      <td>0.679947</td>\n",
       "      <td>-0.074731</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>900</th>\n",
       "      <td>0.903961</td>\n",
       "      <td>-0.011128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>901</th>\n",
       "      <td>1.189029</td>\n",
       "      <td>-0.039368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>902</th>\n",
       "      <td>0.922673</td>\n",
       "      <td>0.016254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>903</th>\n",
       "      <td>1.103565</td>\n",
       "      <td>0.019651</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>904 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     distance  direction\n",
       "0    1.014872  -0.073061\n",
       "1    0.811171   0.040348\n",
       "2    0.784988   0.017991\n",
       "3    1.119175   0.005638\n",
       "4    1.262065   0.022443\n",
       "5    0.919015  -0.036594\n",
       "6    0.873110   0.027826\n",
       "7    1.070208  -0.010506\n",
       "8    1.136828   0.008138\n",
       "9    0.945939  -0.105008\n",
       "10   0.987615  -0.006331\n",
       "11   1.205463   0.052046\n",
       "12   0.958843   0.014954\n",
       "13   1.002921   0.017638\n",
       "14   0.808036   0.006072\n",
       "15   0.885812   0.009431\n",
       "16   0.885897  -0.051119\n",
       "17   0.896757   0.039138\n",
       "18   0.987803   0.091702\n",
       "19   0.986813   0.018123\n",
       "20   0.823929   0.017358\n",
       "21   1.359914  -0.019783\n",
       "22   1.052995   0.014265\n",
       "23   0.941338  -0.053790\n",
       "24   1.040544   0.010090\n",
       "25   0.992751  -0.012571\n",
       "26   1.228835   0.063801\n",
       "27   1.317062  -0.027550\n",
       "28   1.105235  -0.006007\n",
       "29   1.066970  -0.030088\n",
       "..        ...        ...\n",
       "874  0.988875  -0.060102\n",
       "875  1.026914   0.037079\n",
       "876  1.237129  -0.033020\n",
       "877  0.942776  -0.087547\n",
       "878  1.079147   0.036347\n",
       "879  0.935685  -0.051473\n",
       "880  0.835867   0.024130\n",
       "881  0.984819   0.011195\n",
       "882  1.059956   0.050766\n",
       "883  1.037110  -0.056266\n",
       "884  1.041138  -0.022192\n",
       "885  0.974711  -0.042435\n",
       "886  1.005050  -0.005776\n",
       "887  0.931255  -0.015503\n",
       "888  1.257316  -0.055352\n",
       "889  0.989798  -0.004721\n",
       "890  0.860510   0.013746\n",
       "891  1.094758  -0.036899\n",
       "892  0.763186   0.029647\n",
       "893  0.891375   0.077918\n",
       "894  0.793538  -0.012601\n",
       "895  0.871301   0.041858\n",
       "896  1.037124   0.039784\n",
       "897  0.630603   0.019173\n",
       "898  0.925366   0.014392\n",
       "899  0.679947  -0.074731\n",
       "900  0.903961  -0.011128\n",
       "901  1.189029  -0.039368\n",
       "902  0.922673   0.016254\n",
       "903  1.103565   0.019651\n",
       "\n",
       "[904 rows x 2 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys  ###sensor_experiment\n",
    "sys.path.append('../scripts/')\n",
    "from robot import *\n",
    "\n",
    "m = Map()\n",
    "m.append_landmark(Landmark(1,0))\n",
    "\n",
    "distance = []\n",
    "direction = []\n",
    "\n",
    "for i in range(1000):\n",
    "    c = Camera(m)    #バイアスの影響も考慮するため毎回カメラを新規作成\n",
    "    d = c.data(np.array([0.0, 0.0, 0.0]).T)\n",
    "    if len(d) > 0:\n",
    "        distance.append(d[0][0][0])\n",
    "        direction.append(d[0][0][1])\n",
    "        \n",
    "import pandas as pd\n",
    "df = pd.DataFrame()\n",
    "df[\"distance\"] = distance\n",
    "df[\"direction\"] = direction\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "distance     0.143729\n",
       "direction    0.046686\n",
       "dtype: float64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.std() ###sensor_exp_res　(下のmeanも)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "distance     0.999818\n",
       "direction   -0.001492\n",
       "dtype: float64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.mean()        #平均値は使わないが念のため"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
